package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.admin.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmChannelDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class ChannelController {

    @Autowired
    private IWemediaClient iWemediaClient;

    //分页查询
    @PostMapping("/list")
    public ResponseResult sybaseChannels(@RequestBody ChannelDto dto) {
        return iWemediaClient.sybaseChannels(dto);
    }
    //删除频道
    @GetMapping("/del/{id}")
    public ResponseResult deleChannel(@PathVariable Integer id) {
        return iWemediaClient.deleChannel(id);
    }
    //新增频道
    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannelDto wmChannel) {
        System.out.println(wmChannel);
        return iWemediaClient.saveChannel(wmChannel);
    }
    //修改频道
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannelDto wmChannel) {
        return iWemediaClient.updateChannel(wmChannel);
    }
}